import org.junit.jupiter.api.*;
import org.junit.jupiter.api.extension.ExtendWith;

import java.sql.SQLException;
import static org.junit.jupiter.api.Assertions.*;
class jdbcTest {
    @org.junit.jupiter.api.Test
    void getUserData() throws SQLException, ClassNotFoundException {
        jdbc jd=new jdbc();
        assertEquals("hu",jd.getUserData(123458).getFirst().getName(),"1.No");
        assertEquals(true,jd.getUserData(-214311234).isEmpty(),"2.No");
        assertEquals(true,jd.getUserData(12412412).isEmpty(),"3.No");
    }

    @org.junit.jupiter.api.Test
    void addUser() throws SQLException, ClassNotFoundException {
        jdbc jd=new jdbc();
        assertEquals(1,jd.addUser("zhangsan","123"),"1.No");
        assertEquals(0,jd.addUser(null,null),"2.No");
        assertEquals(1,jd.addUser(null,"123"),"3.No");
        assertEquals(0,jd.addUser("LiSi",null),"4.No");
    }
    @Test
    void deleteUser() throws SQLException, ClassNotFoundException {
        jdbc jd=new jdbc();
        assertEquals(1,jd.deleteUser(123467),"1.No");
        assertEquals(0,jd.deleteUser(-214311234),"2.No");
        assertEquals(0,jd.deleteUser(12412412),"3.No");
    }
    void updatePerson() throws SQLException, ClassNotFoundException {
        jdbc jd=new jdbc();
        assertEquals(1,jd.updatePerson(123463,"XI","123"),"1.No");
        assertEquals(0,jd.updatePerson(123463,null,null),"2.No");
        assertEquals(1,jd.updatePerson(123463,null,"123"),"3.No");
        assertEquals(0,jd.updatePerson(123463,"LiSi",null),"4.No");
        assertEquals(0,jd.updatePerson(2142132,"XI","123"),"5.No");
    }
}